#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
#include"queue.h"
#include"stack.h"

void test_stack1()
{
	gugu::stack<int> st;
	st.push(1);
	st.push(2);
	st.push(3);
	st.push(4);

	while (!st.empty())
	{
		cout << st.top() << " ";
		st.pop();
	}
	cout << endl;
}

class Date
{
public:
	friend ostream& operator<<(ostream& _cout, const Date& d);

	Date(int year = 1900, int month = 1, int day = 1)
		: _year(year)
		, _month(month)
		, _day(day)
	{}

	bool operator<(const Date& d)const
	{
		return (_year < d._year) ||
			(_year == d._year && _month < d._month) ||
			(_year == d._year && _month == d._month && _day < d._day);
	}

	bool operator>(const Date& d)const
	{
		return (_year > d._year) ||
			(_year == d._year && _month > d._month) ||
			(_year == d._year && _month == d._month && _day > d._day);
	}
private:
	int _year;
	int _month;
	int _day;
};

ostream& operator<<(ostream& _cout, const Date& d)
{
	_cout << d._year << "-" << d._month << "-" << d._day;
	return _cout;
}

//bool operator<(const Date* d1, const Date* d2)
//{
//	return true;
//}

class GreaterPDate
{
public:
	bool operator()(const Date* p1, const Date* p2)
	{
		return *p1 > *p2;
	}
};


void test_priority_queue2()
{
	/*gugu::priority_queue<Date, vector<Date>, gugu::GreaterPDate<Date>> pq;

	pq.push(1);
	pq.push(5);
	pq.push(6);
	pq.push(2);
	pq.push(8);



	while (!pq.empty())
	{
		cout << pq.top() << " ";
		pq.pop();
	}
	cout << endl;*/

	gugu::priority_queue<Date, vector<Date>, gugu::greater<Date>> pq;

	Date d1(2024, 4, 8);
	pq.push(d1);
	pq.push(Date(2024, 4, 10));
	pq.push({ 2024, 2, 15 });
	pq.push({ 2024, 2, 1 });
	pq.push({ 2024, 2, 12 });

	while (!pq.empty())
	{
		cout << pq.top() << " ";
		pq.pop();
	}
	cout << endl;

	/*gugu::priority_queue<Date*, vector<Date*>, GreaterPDate> pqptr;
	pqptr.push(new Date(2024, 4, 14));
	pqptr.push(new Date(2024, 4, 11));
	pqptr.push(new Date(2024, 4, 15));

	while (!pqptr.empty())
	{
		cout << *(pqptr.top()) << " ";
		pqptr.pop();
	}
	cout << endl;*/
}
int main()
{
	//test_stack1();
	test_priority_queue2();
	return 0;
}